package com.sc.VenusQueryBeta.adapter;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.sc.VenusQueryBeta.R;
import com.sc.VenusQueryBeta.global.MyApplication;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by Administrator on 26/9/2018.
 *貴賓服務適配器
 */

public class UpdateServiceAdapter extends  RecyclerView.Adapter<UpdateServiceAdapter.ViewHolder> {


    private List<String> lists = new ArrayList<>();


    public UpdateServiceAdapter(int id, List<String> list) {
        if (lists.size()==0) {
            lists = list;
//           lists.clear();
        }
    }



    @NonNull
    @Override
    public UpdateServiceAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(MyApplication.app).inflate(R.layout.layout_version_item,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull UpdateServiceAdapter.ViewHolder holder, int position) {
        holder.name.setText(lists.get(position));

    }

    @Override
    public int getItemCount() {
        return lists.size();
    }


    class ViewHolder extends RecyclerView.ViewHolder {
        private TextView name;
        ViewHolder(View itemView) {
            super(itemView);
            name = itemView.findViewById(R.id.tv_info);
        }
    }

}
//public class UpdateServiceAdapter extends BaseCompatAdapter<AboutSKBean.about,BaseViewHolder> {
//    public UpdateServiceAdapter(int layoutResId, @Nullable List<AboutSKBean.about> data) {
//        super(layoutResId, data);
//    }
//
//    @Override
//    protected void convert(BaseViewHolder helper, AboutSKBean.about item) {
//       // helper.setText(R.id.tv_info,item.update);
//
//    }
//}